#pragma once
// MESSAGE KF_XK_P1 PACKING

#define MAVLINK_MSG_ID_KF_XK_P1 26

MAVPACKED(
typedef struct __mavlink_kf_xk_p1_t {
 float Xk1[30]; /*<  Xk1*/
 float Xk0[30]; /*<  Xk0*/
}) mavlink_kf_xk_p1_t;

#define MAVLINK_MSG_ID_KF_XK_P1_LEN 240
#define MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN 240
#define MAVLINK_MSG_ID_26_LEN 240
#define MAVLINK_MSG_ID_26_MIN_LEN 240

#define MAVLINK_MSG_ID_KF_XK_P1_CRC 81
#define MAVLINK_MSG_ID_26_CRC 81

#define MAVLINK_MSG_KF_XK_P1_FIELD_XK1_LEN 30
#define MAVLINK_MSG_KF_XK_P1_FIELD_XK0_LEN 30

#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_KF_XK_P1 { \
    26, \
    "KF_XK_P1", \
    2, \
    {  { "Xk1", NULL, MAVLINK_TYPE_FLOAT, 30, 0, offsetof(mavlink_kf_xk_p1_t, Xk1) }, \
         { "Xk0", NULL, MAVLINK_TYPE_FLOAT, 30, 120, offsetof(mavlink_kf_xk_p1_t, Xk0) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_KF_XK_P1 { \
    "KF_XK_P1", \
    2, \
    {  { "Xk1", NULL, MAVLINK_TYPE_FLOAT, 30, 0, offsetof(mavlink_kf_xk_p1_t, Xk1) }, \
         { "Xk0", NULL, MAVLINK_TYPE_FLOAT, 30, 120, offsetof(mavlink_kf_xk_p1_t, Xk0) }, \
         } \
}
#endif

/**
 * @brief Pack a kf_xk_p1 message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param Xk1  Xk1
 * @param Xk0  Xk0
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_kf_xk_p1_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               const float *Xk1, const float *Xk0)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_KF_XK_P1_LEN];

    _mav_put_float_array(buf, 0, Xk1, 30);
    _mav_put_float_array(buf, 120, Xk0, 30);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_KF_XK_P1_LEN);
#else
    mavlink_kf_xk_p1_t packet;

    mav_array_memcpy(packet.Xk1, Xk1, sizeof(float)*30);
    mav_array_memcpy(packet.Xk0, Xk0, sizeof(float)*30);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_KF_XK_P1_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_KF_XK_P1;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
}

/**
 * @brief Pack a kf_xk_p1 message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param Xk1  Xk1
 * @param Xk0  Xk0
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_kf_xk_p1_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   const float *Xk1,const float *Xk0)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_KF_XK_P1_LEN];

    _mav_put_float_array(buf, 0, Xk1, 30);
    _mav_put_float_array(buf, 120, Xk0, 30);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_KF_XK_P1_LEN);
#else
    mavlink_kf_xk_p1_t packet;

    mav_array_memcpy(packet.Xk1, Xk1, sizeof(float)*30);
    mav_array_memcpy(packet.Xk0, Xk0, sizeof(float)*30);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_KF_XK_P1_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_KF_XK_P1;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
}

/**
 * @brief Encode a kf_xk_p1 struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param kf_xk_p1 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_kf_xk_p1_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_kf_xk_p1_t* kf_xk_p1)
{
    return mavlink_msg_kf_xk_p1_pack(system_id, component_id, msg, kf_xk_p1->Xk1, kf_xk_p1->Xk0);
}

/**
 * @brief Encode a kf_xk_p1 struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param kf_xk_p1 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_kf_xk_p1_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_kf_xk_p1_t* kf_xk_p1)
{
    return mavlink_msg_kf_xk_p1_pack_chan(system_id, component_id, chan, msg, kf_xk_p1->Xk1, kf_xk_p1->Xk0);
}

/**
 * @brief Send a kf_xk_p1 message
 * @param chan MAVLink channel to send the message
 *
 * @param Xk1  Xk1
 * @param Xk0  Xk0
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_kf_xk_p1_send(mavlink_channel_t chan, const float *Xk1, const float *Xk0)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_KF_XK_P1_LEN];

    _mav_put_float_array(buf, 0, Xk1, 30);
    _mav_put_float_array(buf, 120, Xk0, 30);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_XK_P1, buf, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
#else
    mavlink_kf_xk_p1_t packet;

    mav_array_memcpy(packet.Xk1, Xk1, sizeof(float)*30);
    mav_array_memcpy(packet.Xk0, Xk0, sizeof(float)*30);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_XK_P1, (const char *)&packet, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
#endif
}

/**
 * @brief Send a kf_xk_p1 message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_kf_xk_p1_send_struct(mavlink_channel_t chan, const mavlink_kf_xk_p1_t* kf_xk_p1)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_kf_xk_p1_send(chan, kf_xk_p1->Xk1, kf_xk_p1->Xk0);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_XK_P1, (const char *)kf_xk_p1, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
#endif
}

#if MAVLINK_MSG_ID_KF_XK_P1_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_kf_xk_p1_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  const float *Xk1, const float *Xk0)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;

    _mav_put_float_array(buf, 0, Xk1, 30);
    _mav_put_float_array(buf, 120, Xk0, 30);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_XK_P1, buf, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
#else
    mavlink_kf_xk_p1_t *packet = (mavlink_kf_xk_p1_t *)msgbuf;

    mav_array_memcpy(packet->Xk1, Xk1, sizeof(float)*30);
    mav_array_memcpy(packet->Xk0, Xk0, sizeof(float)*30);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_XK_P1, (const char *)packet, MAVLINK_MSG_ID_KF_XK_P1_MIN_LEN, MAVLINK_MSG_ID_KF_XK_P1_LEN, MAVLINK_MSG_ID_KF_XK_P1_CRC);
#endif
}
#endif

#endif

// MESSAGE KF_XK_P1 UNPACKING


/**
 * @brief Get field Xk1 from kf_xk_p1 message
 *
 * @return  Xk1
 */
static inline uint16_t mavlink_msg_kf_xk_p1_get_Xk1(const mavlink_message_t* msg, float *Xk1)
{
    return _MAV_RETURN_float_array(msg, Xk1, 30,  0);
}

/**
 * @brief Get field Xk0 from kf_xk_p1 message
 *
 * @return  Xk0
 */
static inline uint16_t mavlink_msg_kf_xk_p1_get_Xk0(const mavlink_message_t* msg, float *Xk0)
{
    return _MAV_RETURN_float_array(msg, Xk0, 30,  120);
}

/**
 * @brief Decode a kf_xk_p1 message into a struct
 *
 * @param msg The message to decode
 * @param kf_xk_p1 C-struct to decode the message contents into
 */
static inline void mavlink_msg_kf_xk_p1_decode(const mavlink_message_t* msg, mavlink_kf_xk_p1_t* kf_xk_p1)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_kf_xk_p1_get_Xk1(msg, kf_xk_p1->Xk1);
    mavlink_msg_kf_xk_p1_get_Xk0(msg, kf_xk_p1->Xk0);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_KF_XK_P1_LEN? msg->len : MAVLINK_MSG_ID_KF_XK_P1_LEN;
        memset(kf_xk_p1, 0, MAVLINK_MSG_ID_KF_XK_P1_LEN);
    memcpy(kf_xk_p1, _MAV_PAYLOAD(msg), len);
#endif
}
